<!DOCTYPE html>
<html>
  <head>
    <title>Issue #430: Do not validate empty fields that is not required.</title>
    <meta charset="UTF-8" />
    <link rel="stylesheet" type="text/css" href="../css/validationEngine.jquery.css" />
    <script type="text/javascript" src="../js/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="../js/languages/jquery.validationEngine-en.js"></script>
    <script type="text/javascript" src="../js/jquery.validationEngine.js"></script>
    <script type="text/javascript">
      $(document).ready(function () {

      $("#f").submit(function (event) {
        event.preventDefault();
        return false;
      });

      $("#f").validationEngine({

            customFunctions : {
                v : function(field, rules, i, options) {
                    if ($("#f").length === 0) {
                        return options.allrules.required.alertText;
                    }
                }
            }

      });


      });
    </script>
  </head>
  <body>
    <form id="f" style="margin:100px;">
      <!-- Note that the select has no 'options', and we want a custom function to validate it -->
      <select id="s" class="validate[funcCall[v]]"></select>
      <input id="i" type="submit"></input>
    </form>
</html>
